package com.hongxin.nw.netty.model;

import com.hongxin.nw.netty.model.analysis.ASDU;
import lombok.Getter;
import lombok.Setter;

/**
 * @remark --
 * @author: GuoXiaolin
 * @date 2019/7/23 13:43
 * @Version 1.0
 * @Descibe
 */
@Getter
@Setter
public class Transfer {

    public final static boolean needRecord = true;
    public final static boolean needMq = true;
    public final static boolean noNeedRecord = false;
    public final static boolean noNeedMq = false;

    private String code;//设备编号
    private ASDU asdu;//A S D U
    private Object obj;//
    private int record;//记录类型
    private int eType;//设备类型,1:交流,2:直流
    private boolean isNeedRecord;//是否需要应答,false:不需要,true:需要
    private boolean isNeedMq;//是否需要发送MQ,boolean:不需要,true:需要
    private String sendType;//mq类型

    /**
     * 适用应答
     * @param code 设备编号
     * @param asdu A S D U
     * @param obj 数据
     * @param record 记录类型
     * @param eType 设备类型,1:交流,2:直流
     * @param isNeedRecord 是否需要应答,false:不需要,true:需要
     * @param isNeedMq   是否需要发送MQ,boolean:不需要,true:需要
     * @param sendType mq类型
     */
    public Transfer(String code, ASDU asdu, Object obj, int record, int eType, boolean isNeedRecord, boolean isNeedMq,String sendType) {
        this.code = code;
        this.asdu = asdu;
        this.obj = obj;
        this.record = record;
        this.eType = eType;
        this.isNeedRecord = isNeedRecord;
        this.isNeedMq = isNeedMq;
        this.sendType = sendType;
    }

    /**
     *
     * 适用应答
     * @param isNeedRecord  是否需要应答,false:不需要,true:需要
     * @param isNeedMq 是否需要发送MQ,boolean:不需要,true:需要
     * @param sendType  mq类型
     */
    public Transfer(boolean isNeedRecord, boolean isNeedMq,String sendType) {
        this.isNeedRecord = isNeedRecord;
        this.isNeedMq = isNeedMq;
        this.sendType = sendType;
    }

    /**
     * 适用应答
     * 不需要应答,不需要mq
     */
    public Transfer() {
        this.isNeedRecord = noNeedRecord;
        this.isNeedMq = noNeedMq;
    }

    /**
     * 适用请求(默认应答,不mq)
     * @param code 设备编号
     * @param obj 数据
     */
    public Transfer(String code, Object obj) {
        this.code = code;
        this.obj = obj;
        this.isNeedRecord = needRecord;
        this.isNeedMq = noNeedMq;
    }

    /**
     * 适用请求(默认应答,不mq)
     * @param code 设备编号
     */
    public Transfer(String code) {
        this.code = code;
        this.isNeedRecord = needRecord;
        this.isNeedMq = noNeedMq;
    }
}
